// @ts-ignore
/* eslint-disable */

import { request, type RequestOptions } from '@/utils/request';

/**
 * 新增订单
 * @param input 订单信息
 * @returns
 */
export async function order(input: OrderInput, options?: RequestOptions) {
  return request<BuyOrderOut>(`order/order`, {
    method: 'POST',
    data: input,
    ...(options || {}),
  });
}

/**
 * 获取订单详情
 * @param number 订单编号
 * @returns
 */
export async function getOrder(number: string, options?: RequestOptions) {
  return request<OrderOut>(`order/order`, {
    method: 'GET',
    params: { 'number': number },
    ...(options || {}),
  });
}

/**
 * 获取所有订单
 * @param input 订单搜索参数
 * @returns
 */
export async function all(input: OrderSearch, options?: RequestOptions) {
  return request<OrderSearchOut>(`order/all`, {
    method: 'POST',
    data: input,
    ...(options || {}),
  });
}

/**
 * 获取所有订单A
 * @param input 订单搜索参数A
 * @returns
 */
export async function allA(input: OrderSearchA, options?: RequestOptions) {
  return request<OrderSearchOut>(`order/all-a`, {
    method: 'POST',
    data: input,
    ...(options || {}),
  });
}

/**
 * 更新订单信息
 * @param number 订单编号
 * @returns
 */
export async function cash(number: string, options?: RequestOptions) {
  return request<string>(`order/cash`, {
    method: 'GET',
    params: { 'number': number },
    ...(options || {}),
  });
}

/**
 * 获取订单详情
 * @param id 订单ID
 * @returns
 */
export async function get(id: string, options?: RequestOptions) {
  return request<OrderOut>(`order/${id}`, {
    method: 'GET',
    ...(options || {}),
  });
}

/**
 * 获取订单信息
 * @param id 订单ID
 * @returns
 */
export async function info(id: string, options?: RequestOptions) {
  return request<OrderOut>(`order/${id}/info`, {
    method: 'GET',
    ...(options || {}),
  });
}

/**
 * 取消订单
 * @param number 订单编号
 * @returns
 */
export async function cancel(number: string, options?: RequestOptions) {
  return request<string>(`order/cancel`, {
    method: 'GET',
    params: { 'number': number },
    ...(options || {}),
  });
}

/**
 * 预览订单
 * @param image 图片
 * @param number 订单编号
 * @returns
 */
export async function privew(image: string, number: string, options?: RequestOptions) {
  return request<any>(`order/privew`, {
    method: 'GET',
    params: { 'image': image, 'number': number },
    ...(options || {}),
  });
}

/**
 * 支付回调
 * @returns
 */
export async function pay(options?: RequestOptions) {
  return request<string>(`order/pay`, {
    method: 'POST',
    ...(options || {}),
  });
}

/**
 * 完成订单
 * @param number 订单编号
 * @returns
 */
export async function over(number: string, options?: RequestOptions) {
  return request<string>(`order/over`, {
    method: 'GET',
    params: { 'number': number },
    ...(options || {}),
  });
}

/**
 * 删除订单
 * @param number 订单编号
 * @returns
 */
export async function myDelete(number: string, options?: RequestOptions) {
  return request<string>(`order/delete`, {
    method: 'GET',
    params: { 'number': number },
    ...(options || {}),
  });
}

/**
 * 重新支付
 * @param number 订单编号
 * @returns
 */
export async function rePay(number: string, options?: RequestOptions) {
  return request<BuyOrderOut>(`order/re-pay`, {
    method: 'GET',
    params: { 'number': number },
    ...(options || {}),
  });
}

/**
 * 发货
 * @param input 发货信息
 * @returns
 */
export async function sendGoods(input: SendGoodsInput, options?: RequestOptions) {
  return request<string>(`order/send-goods`, {
    method: 'POST',
    data: input,
    ...(options || {}),
  });
}
